angular.module('modal',[])
.service 'Modal',($ionicModal,$rootScope) ->
    $rootScope.style = ''
    setNoFilter:()->
        $rootScope.nofilter = true
    setStyle:(style)->
        $rootScope.style = style
    setText:(attrs) ->
        $rootScope.lineTextList=attrs
    onClick:(funcs) ->
        $rootScope.lineClick=funcs
    showModal:() ->
        if  $rootScope.lineTextList==undefined or $rootScope.lineClick==undefined
            console.log '未设置lineText值或lineCLick事件'
            return
        $ionicModal.fromTemplateUrl('templates/component/modal/modal.html',{
            scope:$rootScope
            animation: 'slide-in-up'
        }).then (modal) ->
            $rootScope.modal = modal
            $rootScope.modal.show()
    hideModal:()->
        if $rootScope.modal!=undefined
#            $rootScope.lineClick=undefined
#            $rootScope.lineTextList=undefined
            $rootScope.modal.hide()